package com.qk.management.service.validator;

import com.qk.common.constants.AvatarMessageConstants;
import org.springframework.web.multipart.MultipartFile;

public class FileSizeValidator extends FileValidationHandler {
    private final long maxSize;
    
    public FileSizeValidator(long maxSize) {
        this.maxSize = maxSize;
    }
    
    @Override
    protected void handle(MultipartFile file) throws ValidationException {
        if (file.getSize() > maxSize) {
            throw new ValidationException(AvatarMessageConstants.FILE_SIZE_EXCEEDS_LIMIT + ": " + maxSize + " bytes");
        }
    }
}